/**
 * 类与接口
 */
export {}
// 不同的类可能会有相似的功能，这时候可以通过接口来约束
// interface EatAndRun {
//   eat (food: string): void
//   run (distance: number): void
// }

// 1个接口只实现1个能力更加合理
interface Eat {
  eat (food: string): void
}

interface Run {
  run (distance: number): void
}

class Person implements Eat, Run {
  eat (food: string): void {
    console.log(`优雅的进餐: ${food}`)
  }

  run (distance: number) {
    console.log(`直立行走: ${distance}`)
  }
}

class Animal implements Eat, Run {
  eat (food: string): void {
    console.log(`呼噜呼噜的吃: ${food}`)
  }

  run (distance: number) {
    console.log(`爬行: ${distance}`)
  }
}

